package packet

import (
	"container/list"
	"fmt"
)

type Packet struct {
	Value int
	From  int
	To    int
	Hops  list.List
	Reply bool
	Path  list.List
}

func (p Packet) PrintPath() {
	for e := p.Hops.Front(); e != nil; e = e.Next() {
		fmt.Print(e.Value.(string) + " ")
	}
	fmt.Println()
}

func (p Packet) IsIn(l list.List) bool {
	for e := l.Front(); e != nil; e = e.Next() {
		if p == e.Value {
			return true
		}
	}
	return false
}
